package com.softeem.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.softeem.dao.EmpMapper;
import com.softeem.dto.Emp;
import com.softeem.service.IEmpService;

@Service
public class EmpService implements IEmpService {

	@Autowired
	private EmpMapper empMapper;  
	
	@Transactional
	@Override
	public boolean addEmp(Emp emp) {
		int i = empMapper.insert(emp);
		//System.out.println(10/0);
//		empMapper.deleteByPrimaryKey(23);
		return i > 0;
	}

	@Transactional(propagation=Propagation.REQUIRED)
	@Override
	public Emp queryByEno(Integer eno) {
		return empMapper.selectByPrimaryKey(eno);
	}

	@Override
	public List<Emp> queryAll() {
		// TODO Auto-generated method stub
		return null;
	}

}
